package com.jiyi.exception;


import android.app.Dialog;
import android.content.Context;

import com.swift.maintenance.utils.ToastUtil;
import com.swift.utils.DialogTool;

import io.reactivex.disposables.Disposable;

/**
 * Created by 12262 on 2016/6/5.
 */
public abstract class SampleProgressObserver<T> extends MyObserver<T>{

    private Dialog dialog;
    private Context context;

    public SampleProgressObserver(Context context) {
        dialog = DialogTool.creatDialog(dialog,context);
        this.context = context;
    }

    @Override
    public void onSubscribe(Disposable d) {
        dialog.show();
    }

    @Override
    protected void onError(ApiException ex) {
        dialog.dismiss();
        ToastUtil.getInstances().showMsg(ex.getDisplayMessage());
    }


    @Override
    public void onNext(T t) {

    }

    @Override
    public void onComplete() {
        dialog.dismiss();
    }
}
